<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>"><!-- jsp文件头和头部 -->
	<%@ include file="../../system/admin/top.jsp"%> 
	</head>
<body>
			<!-- 检索  -->
			<form action="boapply/list.do?b=1" method="post" name="Form" id="Form">
			<div class="con-form">
			     <input autocomplete="off" id="nav-search-input" type="text" name="keyWord" value="${pd.keyWord}" placeholder="这里输入关键词" />
			     <button class="search" onclick="search();"  title="查询">查询</button>
			</div>
			<table>
				  <colgroup>
		            <col width="2%">
		            <col width="2%">
		            <col width="13%">
		            <col width="9%">
		            <col width="13%">
		            <col width="9%">
		            <col width="6%">
		            <col width="13%">
		            <col width="6%">
		            <col width="15%">
		        </colgroup>
				<thead>
					<tr>
						<th><input type="checkbox" id="zcheckbox" /></th>
						<th>序号</th>
						<th>分公司名称</th>
						<th>成立时间</th>
						<th>地区</th>
						<th>业务范围</th>
						<th>保证金</th>
						<th>管理费</th>
						<th>合同到期时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty varList}">
						<c:if test="${QX.cha == 1 }">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
							            <td>
									    <input type='checkbox' name='ids' value="${var.filiale_id}" />
									    </td>
								        <td >${vs.index+1}</td>
										<td>${var.filiale_name}</td>
										<td ><fmt:formatDate value="${var.establish_time}" pattern="yyyy-MM-dd"/></td>
										<td>${var.region}</td>
										<td>${var.preparing_for_business}</td>
										<td>${var.filiale_operating_margin}</td>
										<td>${var.filiale_management_expense}</td>
										<td><fmt:formatDate value="${var.expire}" pattern="yyyy-MM-dd"/></td>
										<td>
										<p class="operate">
										<a class="create Operate" onclick="upload('${var.filiale_id}')">上传交纳凭证</a>
										</p>
										</td>
							</tr>
						
						</c:forEach>
						</c:if>
						<c:if test="${QX.cha == 0 }">
							<tr>
								<td colspan="100" class="center">您无权查看</td>
							</tr>
						</c:if>
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="100" class="center" >没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
		<div class="branchPage">${page.pageStr}</div>
		</form>
		<!-- 返回顶部  -->
		<script type="text/javascript">
		//检索
		function search(){
			$("#Form").submit();
		}

		$(function() {
			//复选框
			$('table th input:checkbox').on('click' , function(){
				var that = this;
				$(this).closest('table').find('tr > td:first-child input:checkbox')
				.each(function(){
					this.checked = that.checked;
					$(this).closest('tr').toggleClass('selected');
				});
					
			});
			
		});
		
		//上传交纳凭证
		function upload(filiale_id){
			 $("#zhongxin",domObj).show();
			$("#zhongxin iframe",domObj).attr("src","<%=basePath%>bomanagementpay/goAdd.do?filiale_id="+filiale_id);
		}
		
		//批量操作
		function makeAll(msg){
			bootbox.confirm(msg, function(result) {
				if(result) {
					var str = '';
					for(var i=0;i < document.getElementsByName('ids').length;i++)
					{
						  if(document.getElementsByName('ids')[i].checked){
						  	if(str=='') str += document.getElementsByName('ids')[i].value;
						  	else str += ',' + document.getElementsByName('ids')[i].value;
						  }
					}
					if(str==''){
						bootbox.dialog("您没有选择任何内容!", 
							[
							  {
								"label" : "关闭",
								"class" : "btn-small btn-success",
								"callback": function() {
									//Example.show("great success");
									}
								}
							 ]
						);
						
						$("#zcheckbox").tips({
							side:3,
				            msg:'点这里全选',
				            bg:'#AE81FF',
				            time:8
				        });
						
						return;
					}else{
						if(msg == '确定要删除选中的数据吗?'){
							top.jzts();
							$.ajax({
								type: "POST",
								url: '<%=basePath%>boinfo/deleteAll.do?tm='+new Date().getTime(),
						    	data: {DATA_IDS:str},
								dataType:'json',
								//beforeSend: validateData,
								cache: false,
								success: function(data){
									 $.each(data.list, function(i, list){
											nextPage(${page.currentPage});
									 });
								}
							});
						}
					}
				}
			});
		}
		</script>
		
	</body>
</html>

